<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateActSignin extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('act_signin_log', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedSmallInteger('signin_day')->default(1)->comment('当前连续签到天数');
            $table->unsignedSmallInteger('reward_gift_id')->default(0)->comment('签到获得礼物ID');
            $table->unsignedSmallInteger('reward_gift_num')->default(1)->comment('获得礼物数量');
            $table->timestamps();
            $table->unsignedTinyInteger('flag')->default(1);
            $table->index('user_id', 'user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('act_signin');
    }
}
